import request from '@/config/axios'

export interface ContactPersonVO {
  id: number
  customerId: number
  name: string
  phone: string
  gender: number
  email: string
  wechat: string
  qq: string
  position: string
  isPrimary: boolean
  remark: string
  createTime: Date
}

export interface ContactPersonPageReqVO extends PageParam {
  customerId?: number
  name?: string
  phone?: string
  createTime?: Date[]
}

export interface ContactPersonSaveReqVO {
  id?: number
  customerId: number
  name: string
  phone: string
  gender: number
  email: string
  wechat: string
  qq: string
  position: string
  isPrimary: boolean
  remark: string
}

export const ContactPersonApi = {
  // 查询联系人分页
  getContactPersonPage: (params: ContactPersonPageReqVO) => {
    return request.get({ url: '/oa/contact-person/page', params })
  },

  // 查询联系人详情
  getContactPerson: (id: number) => {
    return request.get({ url: '/oa/contact-person/get?id=' + id })
  },

  // 新增联系人
  createContactPerson: (data: ContactPersonSaveReqVO) => {
    return request.post({ url: '/oa/contact-person/create', data })
  },

  // 修改联系人
  updateContactPerson: (data: ContactPersonSaveReqVO) => {
    return request.put({ url: '/oa/contact-person/update', data })
  },

  // 删除联系人
  deleteContactPerson: (id: number) => {
    return request.delete({ url: '/oa/contact-person/delete?id=' + id })
  }
} 